Method for operating a computer system

ABSTRACT

The invention relates to a method for operating a computer system. The inventive method allows best possible utilization of the efficiency of a concrete target hardware by providing in a program alternative passages of which exactly one is selected for execution by the processor by means of a code.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is the US National Stage of International ApplicationNo. PCT/DE02/03918, filed Oct. 16, 2002 and claims the benefit thereof.The International Application claims the benefits of German applicationNo. 10152729.2 filed Oct. 25, 2001, both of the applications areincorporated by reference herein in their entirety.

FIELD OF INVENTION

The invention relates to a method for operating a computer system.

BACKGROUND OF INVENTION

Computer systems and the corresponding methods for operating them aregenerally known. A computer system—or computer for short—features aprocessor or a corresponding processing unit which is in a position toexecute commands in accordance with a defined command set and toinitiate the actions corresponding to the commands in each case.Processors and processing units of the above type are referred to ingeneral terms below as processors.

There are processors of the type defined above in various performanceclasses and with different instruction sets. Whereas each processor willprovide commands in some form or another, for adding two numbers forexample, the number of commands that are to be executed on a processorto perform such an addition, e.g. an addition of two so-called longnumbers, varies widely. If a first processor can address these two longnumbers directly and has the corresponding internal registers in whichthese two long numbers can be buffered, the addition can for example beimplemented with one or two processor commands. For another processorthe same function can require significantly more processor commands tobe executed, e.g. if the addition of the long numbers has to be executedbyte-by-byte or word-by-word, so that the addition has to be broken downinto individual part additions and finally in a concluding step anypossible carry over has to be taken into account. The addition is thenperformed more quickly—disregarding the clock frequency with which theprocessor is controlled—on that processor on which fewer processorcommands are to be executed.

Software programs which include such additions for example and are to berun on the processor or executed by the processor are currently usuallycoded using what are known as high-level programming languages. Aspecific translation program, known as the compiler, takes care of thetranslation of the commands of the programming language into commandswhich the processor can execute directly. This makes it clear that acompiler has previously been tailored to the processor concerned onwhich the compiled program is subsequently to be run.

For compilers which create executable code for the widely usedprocessors from Intel, e.g. processors of type 8088, 8086, 80186, 80286,80386, 80486, Pentium, etc. it is often possible to select theprocessors for which the compiler is to create the executable code. Iffor example executable code for execution on a processor of type 80486has been created with the compiler, this code also contains thoseprocessor commands which distinguish a processor of type 80486 from forexample a processor of type 8086. The execution of code optimized inthis way for a processor of type 80486 is thereby more efficient than ifthe compiler had created code for a processor of type 8086 and this codewere to be run on a processor of type 80486. To this extent there existswhat is known as upwards compatibility between the processors listedabove, as can also be found for processors of other well-known processorfamilies. However no downwards compatibility is provided so that a codewhich was created for a processor of type 80486 cannot be executed on aprocessor of type 8086, since this code also features processor commandsthat only a processor of type 80486 is in a position to execute.

A program which has been created can thus not simply be transferred froma first processor onto a second processor with a different range offunctions. When the program is transferred to a processor with a smallerrange of functions it is under some circumstances not possible toexecute the program since the processor with the smaller range offunctions cannot execute some instructions contained in the program.When the program is transferred to a processor with a larger range offunctions execution of the program is generally safeguarded, however thedisadvantage is that the additional performance of the processor cannotbe exploited.

What are known as preprocessors are already known from softwaredevelopment, which prepare a source program, source code as an input forthe compiler by essentially executing textual expansions orreplacements. The preprocessor is a specific software program which isused before the compiler is used. The preprocessor is able to recognizespecific elements in the source code on the basis of a unique syntax oron the basis of a unique format. The usual case is for example anapplication in which the programmer provides instructions in the sourcecode which make it easier to find possible errors during development. Inthe final program however these instructions should no longer bepresent. To do this the programmer embeds the corresponding instructionsin a pre-processor instructions provided for this purpose, such as #ifDEBUG . . . #endif. The result of these is that after the source codehas been processed by the preprocessor, the instructions containedbetween the markers #if and #endif are only still included if the symbolDEBUG was defined. The programmer can thus almost operate a switch bydefining a symbol which affects the type and scope of the generatedprogram.

SUMMARY OF INVENTION

The object of the invention is to specify a method with which thedisadvantageous situation outlined above can be overcome and that opensup similar flexibility to that of a preprocessor.

In accordance with the invention this object is achieved by a methodwith the features of claim 1. This initially requires that a computersystem—as is generally normal—features a memory and a processor and inaddition a code specifying the performance of the computer system and/orthe processor.—The performance of the computer system and/or theprocessor is directly correlated with the relevant scope of functions.—Aprogram specially developed with an engineering system and a filterprogram are stored in the memory of the computer system.

A further requirement is that the program contains “alternativepassages” in which case the code which is contained in the first branchof such an alternative passage gets executed on a processor of a firstperformance class, code which is contained in the second branch of suchan alternative passage gets executed on a processor of a secondperformance class and code which is contained in the third branch ofsuch an alternative passage gets executed on a processor of a thirdperformance class etc.

Accordingly the program includes “normal” instructions and at least onesection with a selection and a reference criterion and at least twoalternative passages, in which case each passage contains its ownparticular instructions. The filter program is provided to generate anexecutable program from the program already stored in memory. The filterprogram in this case directly accepts into the executable program each“normal” instruction of the program already stored in memory. If thefilter program encounters a section with alternative passages, eachinstruction is transferred to precisely one passage of this section inaccordance with the selection and reference criterion of this sectionand the code in the executable program.

The invention operates here on the assumption that the programmerprovides in the relevant program not only the code for a processor of afirst performance class, but also code for a processor of a second and athird and possibly further performance classes and as regards executionby the processor embeds this into alternative passages in suitablestructures, on the basis of which at least the beginning and the end ofeach alternative passage can be detected. Then, when the generated codeis executed, it is established at the beginning of such an alternativepassage on the basis of the code, which performance class the relevantprocessor and/or computer system offers and the appropriate alternativepassage is selected for this performance class, so that the processorcommands which the processor can actually execute get executed, but theexecuted processor commands use as much as possible of the specificcapabilities of the actual processor.

It is also possible for the compiler to create such alternative passagesitself, if it has access to the relevant scheme for each processor classfor transforming specific commands and instructions of a higher-levelprogramming language in each case into a code that can be executed bythe relevant processor. An example of such an arrangement is an additionwhich occurs in a program which is expressed in the programming languageas “a =b +c”, but can be implemented in different ways depending on theprocessor. Then the compiler creates a separate alternative passage foreach implementation, which is selected for execution of the program on aspecific processor on the basis of its actual capabilities.

The advantage of the invention lies in the fact that the only processorcommands which get executed are those which the relevant processor canactually execute and simultaneously that with the processor commandsexecuted, the best possible use is made of the specific capabilities ofthe actual processor.

The dependent claims are directed to preferred embodiments of thepresent invention.

Advantageously there is provision for the filter program to execute theprogram in portions, in that with “normal” instructions one instructionafter the other is read out of the program and is transferred into theexecutable program and in that, for a section, in accordance with theselection and reference criterion of the section as well as the code,the beginning and the end of precisely one passage is determined andeach instruction of the passage is read out successively and transferredinto the executable program.

Alternatively there is advantageous provision for the filter program toexecute the program in portions in that with “normal” instructions oneinstruction after the other is read out of the program and istransferred into the executable program and in that, for a section inaccordance with the selection and reference criterion of the section aswell as the code, the beginning of precisely one passage is determinedand until a data item identifying the end of the passage is reached,each instruction of the passage is read out successively and transferredinto the executable program.

BRIEF DESCRIPTION OF THE DRAWINGS

An exemplary embodiment of the invention is explained in more detailbelow on the basis of the drawing. Parts of the drawing which correspondto each other are given the same reference number in each diagram.

The drawings show

FIG. 1 a computer system,

FIG. 2 a a program with alternative passages and

FIG. 2 b an executable program derived from this.

DETAILED DESCRIPTION OF INVENTION

FIG 1 shows a schematic diagram of a computer system 1 with a memory 2and a processor 3. In the memory 2 are stored an operating system 4 anda filter program 5. An engineering system 6 is provided for creation ofa program 7 also loaded into memory 2. The filter program 5 creates fromthe program 7 executable program 8 which can be run by processor 3. Theengineering system 6 is for example a programming device withengineering software that can be executed on it which offers at leastthe functionality of an editor and that of a compiler or of a compilerand a linker.

A code 9 is stored in memory 2 and/or in processor 3 with which theperformance of processor 3 and/or of computer system 1 is specified.Identifier 9 has a value of “1” for example, if processor 3 or computersystem 1 can only execute programs which require functionality inaccordance with a first performance class. Accordingly code 9 has avalue of “2” for example if processor 3 or computer system 1 can executeprograms which require a functionality corresponding to a secondperformance class etc.

The creation of the executable program 8 from program 7 is explained onthe basis of FIGS. 2 a and 2 b.

FIG. 2 a shows a section of program 7 with instructions 10 contained init. Instructions 10 can be executed by processor 3. At a specific pointprogram 7 contains a section 11 which comprises a selection andreference criterion 12 as well as at least two alternative passages 13,14, 15. Each passage 13, 14, 15 in its turn comprises instructions 101,102, 103. The instructions 101 of the first alternative passage 13correspond, as regards the functionality that they trigger, theinstructions 102, 103 of the second or third alternative passage. Theinstructions 101, 102, 103 themselves may however differ in this case,since namely in alternative passage 13 for example such instructions 101are contained that a processor 3 or a computer system 1 of a firstperformance class can execute. Accordingly the second and thirdalternative passage 14, 15 contains such instructions 102, 103 that aprocessor 3 or a computer system 1 of a second or third performanceclass can execute.

After section 11 the program 7 is continued with instructions 10.Further down in program 7 there can be a further section 11 which in itsturn contains alternative passages. The number of alternative passagesin a specific section 11 is exclusively dependent on how manyalternative passages the programmer has provided for the relevantsection.

FIG. 2 b shows the executable program 8 which was created with thefilter program 5 from the program 7. The executable program 8, just likeprogram 7, contains instructions 10. The instructions 10 shown in FIG. 2a also correspond to those which are shown in FIG. 2 b. The instructions10 are thus transferred unchanged by filter program 5 from program 7into executable program 8. If filter program 5 detects a selection andreference criterion 12, depending on the value of the code 9 one of thealternative passages 13, 14, 15 with the instructions 101, 102, 103 thatit contains is transferred into the executable program. FIG. 2 b showsthe arrangement where the value of the code 9 has led to the selectionof the third alternative passage 15. According the instructions 103contained in this passage 15 are transferred into the executableprogram.

The executable program can now be executed on computer system 1 byprocessor 3. When this is done it is ensured that the performance ofcomputer systems 1 and its processor 3 are exploited to the bestpossible degree. If the same program 7 is loaded onto a computer system1 for which the code has a lower value, its filter program 5, instead offor example the instructions 103 from the third alternative passage, thefilter program transfers the instructions 102 from the secondalternative passage into the executable program 8. This means thatprogram 7 can be executed on different computer systems without manualintervention with guaranteed optimum use always being made of theperformance of computer system 1 and processor 3.

An alternative of equal value in many respects of the method inaccordance with the invention consists of not converting program 7 intoan executable program 8 by a filter program, but of undertaking thisconversion at runtime by the processor 3 itself. From the structureinformation, which in accordance with the previously describedimplementation of the method in accordance with the invention at leastdelimits the alternative passages 13, 14, 15 from each other, commandswhich can be executed directly by processor 3 are formed. The selectionand reference criterion 12 is accordingly replaced by a number of branchinstructions tailored to the number of alternative passages 13, 14, 15,so that on execution of program 7 there is a direct branch in accordancewith code 9 to the beginning of the relevant passage 13, 14, 15. At theend of a passage 13, 14, 15 selected in this way subsequent furtherpassages 13, 14, 15 are skipped if necessary, in that the processing ofprogram 7 is continued at the end of section 10 with the alternativepassages 13, 14, 15. Slight speed overheads during the execution ofprogram 7 caused by the interrogation of code 9 at runtime arecompensated for by the fact that program 7 only has to be stored once oncomputer system 1 and that program 7 can be transferred directly fromthe computer system to another computer system 1 and can be executedthere.

Thus the invention can be briefly presented as follows:

The method in accordance with the invention provides the option ofmaking the best possible use of the actual destination hardware 1, 3 inthat alternative passages 13, 14, 15 are provided in a program 7 ofwhich precisely one is selected for execution by the processor 3 on thebasis of a code 9.

1. A method for operating a computer system having a memory, aprocessor, and a code specifying the performance of the computer systemand/or the processor, the method comprising: storing a first program andin the memory, and storing a filter program in the memory to compile thefirst program into executable code, wherein the first program includesinstructions and at least one section with a selection and referencecriterion and at least two alternate passages having instructions; andgenerating the executable code from the first program with the filterprogram, wherein; instructions of only one of the at least two alternatepassages are selected and converted into object code in accord with theselection and reference criterion of the section relative to the codespecifying the performance of the computer system and/or the processorso that performance of the computer system and the processor whenexecuting the first program are exploited to the best possible degree.2. A method in accordance with claim 1, wherein the filter programexecutes the first program in sections, and wherein with instructionsone instruction after the other is read out of the first program andtransferred into the executable program, and wherein with a section,according to a selection and reference criterion of the section and thecode the beginning and end of precisely one passage is determined andeach instruction of the passage is successively read and transferredinto the executable program.
 3. A method according to claim 1, whereinthe filter program executes the first program in sections, wherein withinstructions one instruction after the other is read out of the programand transferred into the executable program, and wherein with a section,according to a selection and reference criterion of the section and thecode the beginning of precisely one passage is determined and, until adata item identifying the end of the passage is reached, eachinstruction of the passage is successively read and transferred into theexecutable program.
 4. A method according to claim 1, wherein theprogram is created with an engineering system.